package com.wolfalpha.utron.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.wolfalpha.utron.R;
import com.wolfalpha.utron.activity.base.BaseNormal2Activity;
import com.wolfalpha.utron.adapter.ItemInformationAdapter;
import com.wolfalpha.utron.bean.ItemInformation;
import com.wolfalpha.utron.ui.UIHelper;

import java.util.ArrayList;
import java.util.List;

/**
 * 用户相关
 * <p/>
 * Created by luodon on 15/8/19.
 */
public class MyRelationActivity extends BaseNormal2Activity implements AdapterView.OnItemClickListener {

    private ListView lvAttention;      //列表控件

    private ItemInformationAdapter itemInformationAdapter;//资讯适配器
    private List<ItemInformation> informations = new ArrayList<ItemInformation>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_my_ideas);

        loadData();
        intiView();
        initListeners();
    }

    /**
     * 加载列表的数据
     */
    private void loadData() {
        ItemInformation information = new ItemInformation();
        information.setGrates(11);
        information.setShare(12);
        information.setUseless(14);
        information.setTitle("我是标题");

        informations.add(information);

        itemInformationAdapter = new ItemInformationAdapter(this, informations);
    }

    /**
     * 初始化界面
     */
    private void intiView() {
        setTvTitle("与我相关");

//        lvAttention = (ListView) findViewById(R.id.lv_relation);

        lvAttention.setAdapter(itemInformationAdapter);
    }

    /**
     * 初始化监听
     */
    private void initListeners() {
        lvAttention.setOnItemClickListener(this);
    }

    @Override
    public void rightOperation() {
        UIHelper.ToastMessage(this, "您点击了删除按钮");
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        UIHelper.ToastMessage(this, "您点击了" + position);
    }
}
